package com.heaven.mapper;

import com.heaven.pojo.Honor;
import org.apache.ibatis.annotations.*;

import java.util.List;

public interface HonorMapper {
    @Select("select * from honor where honorname like \"%\" #{query}\"%\" " +
            "limit #{startNum},#{size}")
    List<Honor> honorList(@Param("size") int size,
                          @Param("startNum") int startNum,
                          @Param("query") String query);
    @Select("select count(1) from honor where honorname like \"%\"#{query}\"%\" ")
    long findHonorList(String query);

    @Select("select * from honor where id=#{id}")
    Honor honorById(Integer id);

    @Update("update honor set honorname=#{honorname},honormessage=#{honormessage}," +
            "honortime=#{honortime} where id=#{id}")
    void updataHonor(Honor honor);

    @Insert("insert into honor values(null,#{honorname}," +
            "#{honormessage},#{honortime})")
    void addHonor(Honor honor);

    @Delete("delete from honor where id=#{id}")
    void deleteById(Integer id);
}
